/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lomanda
 */
@Entity
@Table(name = "permissao")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Permissao.findAll", query = "SELECT p FROM Permissao p"),
    @NamedQuery(name = "Permissao.findByIdPermissao", query = "SELECT p FROM Permissao p WHERE p.idPermissao = :idPermissao"),
    @NamedQuery(name = "Permissao.findByModuloUsuarios", query = "SELECT p FROM Permissao p WHERE p.moduloUsuarios = :moduloUsuarios"),
    @NamedQuery(name = "Permissao.findByModuloProducao", query = "SELECT p FROM Permissao p WHERE p.moduloProducao = :moduloProducao"),
    @NamedQuery(name = "Permissao.findByModuloFinancas", query = "SELECT p FROM Permissao p WHERE p.moduloFinancas = :moduloFinancas"),
    @NamedQuery(name = "Permissao.findByModuloRh", query = "SELECT p FROM Permissao p WHERE p.moduloRh = :moduloRh"),
    @NamedQuery(name = "Permissao.findByModuloSeguranca", query = "SELECT p FROM Permissao p WHERE p.moduloSeguranca = :moduloSeguranca"),
    @NamedQuery(name = "Permissao.findByModuloAdministrativo", query = "SELECT p FROM Permissao p WHERE p.moduloAdministrativo = :moduloAdministrativo"),
    @NamedQuery(name = "Permissao.findByModuloStock", query = "SELECT p FROM Permissao p WHERE p.moduloStock = :moduloStock"),
    @NamedQuery(name = "Permissao.findByModuloAluguer", query = "SELECT p FROM Permissao p WHERE p.moduloAluguer = :moduloAluguer"),
    @NamedQuery(name = "Permissao.findByModuloPatrimonio", query = "SELECT p FROM Permissao p WHERE p.moduloPatrimonio = :moduloPatrimonio"),
    @NamedQuery(name = "Permissao.findByModuloCompra", query = "SELECT p FROM Permissao p WHERE p.moduloCompra = :moduloCompra")})
public class Permissao implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    //@NotNull
    @Column(name = "idPermissao")
    private Integer idPermissao;
    @Basic(optional = false)
    @NotNull
    @Column(name = "moduloUsuarios")
    private boolean moduloUsuarios;
    @Basic(optional = false)
    @NotNull
    @Column(name = "moduloProducao")
    private boolean moduloProducao;
    @Basic(optional = false)
    @NotNull
    @Column(name = "moduloFinancas")
    private boolean moduloFinancas;
    @Basic(optional = false)
    @NotNull
    @Column(name = "moduloRh")
    private boolean moduloRh;
    @Basic(optional = false)
    @NotNull
    @Column(name = "moduloSeguranca")
    private boolean moduloSeguranca;
    @Basic(optional = false)
    @NotNull
    @Column(name = "moduloAdministrativo")
    private boolean moduloAdministrativo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "moduloStock")
    private boolean moduloStock;
    @Basic(optional = false)
    @NotNull
    @Column(name = "moduloAluguer")
    private boolean moduloAluguer;
    @Basic(optional = false)
    @NotNull
    @Column(name = "moduloPatrimonio")
    private boolean moduloPatrimonio;
    @Basic(optional = false)
    @NotNull
    @Column(name = "moduloCompra")
    private boolean moduloCompra;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkPermissao")
    private List<Perfil> perfilList;

    public Permissao() {
    }

    public Permissao(Integer idPermissao) {
        this.idPermissao = idPermissao;
    }

    public Permissao(Integer idPermissao, boolean moduloUsuarios, boolean moduloProducao, boolean moduloFinancas, boolean moduloRh, boolean moduloSeguranca, boolean moduloAdministrativo, boolean moduloStock, boolean moduloAluguer, boolean moduloPatrimonio, boolean moduloCompra) {
        this.idPermissao = idPermissao;
        this.moduloUsuarios = moduloUsuarios;
        this.moduloProducao = moduloProducao;
        this.moduloFinancas = moduloFinancas;
        this.moduloRh = moduloRh;
        this.moduloSeguranca = moduloSeguranca;
        this.moduloAdministrativo = moduloAdministrativo;
        this.moduloStock = moduloStock;
        this.moduloAluguer = moduloAluguer;
        this.moduloPatrimonio = moduloPatrimonio;
        this.moduloCompra = moduloCompra;
    }

    public Integer getIdPermissao() {
        return idPermissao;
    }

    public void setIdPermissao(Integer idPermissao) {
        this.idPermissao = idPermissao;
    }

    public boolean getModuloUsuarios() {
        return moduloUsuarios;
    }

    public void setModuloUsuarios(boolean moduloUsuarios) {
        this.moduloUsuarios = moduloUsuarios;
    }

    public boolean getModuloProducao() {
        return moduloProducao;
    }

    public void setModuloProducao(boolean moduloProducao) {
        this.moduloProducao = moduloProducao;
    }

    public boolean getModuloFinancas() {
        return moduloFinancas;
    }

    public void setModuloFinancas(boolean moduloFinancas) {
        this.moduloFinancas = moduloFinancas;
    }

    public boolean getModuloRh() {
        return moduloRh;
    }

    public void setModuloRh(boolean moduloRh) {
        this.moduloRh = moduloRh;
    }

    public boolean getModuloSeguranca() {
        return moduloSeguranca;
    }

    public void setModuloSeguranca(boolean moduloSeguranca) {
        this.moduloSeguranca = moduloSeguranca;
    }

    public boolean getModuloAdministrativo() {
        return moduloAdministrativo;
    }

    public void setModuloAdministrativo(boolean moduloAdministrativo) {
        this.moduloAdministrativo = moduloAdministrativo;
    }

    public boolean getModuloStock() {
        return moduloStock;
    }

    public void setModuloStock(boolean moduloStock) {
        this.moduloStock = moduloStock;
    }

    public boolean getModuloAluguer() {
        return moduloAluguer;
    }

    public void setModuloAluguer(boolean moduloAluguer) {
        this.moduloAluguer = moduloAluguer;
    }

    public boolean getModuloPatrimonio() {
        return moduloPatrimonio;
    }

    public void setModuloPatrimonio(boolean moduloPatrimonio) {
        this.moduloPatrimonio = moduloPatrimonio;
    }

    public boolean getModuloCompra() {
        return moduloCompra;
    }

    public void setModuloCompra(boolean moduloCompra) {
        this.moduloCompra = moduloCompra;
    }

    @XmlTransient
    public List<Perfil> getPerfilList() {
        return perfilList;
    }

    public void setPerfilList(List<Perfil> perfilList) {
        this.perfilList = perfilList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPermissao != null ? idPermissao.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Permissao)) {
            return false;
        }
        Permissao other = (Permissao) object;
        if ((this.idPermissao == null && other.idPermissao != null) || (this.idPermissao != null && !this.idPermissao.equals(other.idPermissao))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Permissao[ idPermissao=" + idPermissao + " ]";
    }
    
}
